/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ordering.pojo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author sulan
 */
@Entity
@Table(name = "t_food_type")
@NamedQueries({@NamedQuery(name = "TFoodType.findAll", query = "SELECT t FROM TFoodType t"), @NamedQuery(name = "TFoodType.findByFoodTypeOid", query = "SELECT t FROM TFoodType t WHERE t.foodTypeOid = :foodTypeOid"), @NamedQuery(name = "TFoodType.findByFoodTypeName", query = "SELECT t FROM TFoodType t WHERE t.foodTypeName = :foodTypeName"), @NamedQuery(name = "TFoodType.findByPhotoName", query = "SELECT t FROM TFoodType t WHERE t.photoName = :photoName")})
public class TFoodType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "food_type_oid")
    private Long foodTypeOid;
    @Column(name = "food_type_name")
    private String foodTypeName;
    @Lob
    @Column(name = "photo")
    private byte[] photo;
    @Column(name = "photo_name")
    private String photoName;
    @OneToMany(mappedBy = "foodTypeOid", fetch = FetchType.EAGER)
    private Collection<TMenu> tMenuCollection;

    public TFoodType() {
    }

    public TFoodType(Long foodTypeOid) {
        this.foodTypeOid = foodTypeOid;
    }

    public Long getFoodTypeOid() {
        return foodTypeOid;
    }

    public void setFoodTypeOid(Long foodTypeOid) {
        this.foodTypeOid = foodTypeOid;
    }

    public String getFoodTypeName() {
        return foodTypeName;
    }

    public void setFoodTypeName(String foodTypeName) {
        this.foodTypeName = foodTypeName;
    }

    public byte[] getPhoto() {
        return photo;
    }

    public void setPhoto(byte[] photo) {
        this.photo = photo;
    }

    public String getPhotoName() {
        return photoName;
    }

    public void setPhotoName(String photoName) {
        this.photoName = photoName;
    }

    public Collection<TMenu> getTMenuCollection() {
        return tMenuCollection;
    }

    public void setTMenuCollection(Collection<TMenu> tMenuCollection) {
        this.tMenuCollection = tMenuCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (foodTypeOid != null ? foodTypeOid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TFoodType)) {
            return false;
        }
        TFoodType other = (TFoodType) object;
        if ((this.foodTypeOid == null && other.foodTypeOid != null) || (this.foodTypeOid != null && !this.foodTypeOid.equals(other.foodTypeOid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return foodTypeName;
    }

}
